import {createRouter, createWebHistory} from 'vue-router'

const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: [
        {
            path: '/',
            name: 'home',
            component: () => import('../components/layout/default/Index.vue'),
            children: [
                {
                    path: 'blog',
                    name: 'blog',
                    component: () => import('../view/blog/Blog.vue'),
                    children: [
                        {
                            path: 'article',
                            name: 'article',
                            component: () => import('../view/blog/article/Article.vue'),
                        },
                        {
                            path: 'catalog',
                            name: 'catalog',
                            component: () => import('../view/blog/catalog/Catalog.vue'),
                        },
                        {
                            path: 'info',
                            name: 'info',
                            component: () => import('../view/blog/info/Info.vue'),
                        }
                    ]
                },
                {
                    path: 'manage',
                    name: 'manage',
                    component: () => import('../view/manage/Manage.vue'),
                    children: [
                        {
                            path: 'account',
                            name: 'account',
                            component: () => import('../view/manage/account/Account.vue'),
                        },
                        {
                            path: 'org',
                            name: 'org',
                            component: () => import('../view/manage/org/Org.vue'),
                        },
                        {
                            path: 'role',
                            name: 'role',
                            component: () => import('../view/manage/role/Role.vue'),
                        },
                        {
                            path: 'api',
                            name: 'api',
                            component: () => import('../view/manage/api/Api.vue'),
                        },
                        {
                            path: 'view',
                            name: 'view',
                            component: () => import('../view/manage/view/View.vue'),
                        },
                        {
                            path: 'dict',
                            name: 'dict',
                            component: () => import('../view/manage/dict/Dict.vue'),
                        },
                        {
                            path: 'parameter',
                            name: 'parameter',
                            component: () => import('../view/manage/parameter/Parameter.vue'),
                        },
                        {
                            path: 'person',
                            name: 'person',
                            component: () => import('../view/manage/person/Person.vue'),
                        },
                    ]
                },
            ]
        },
        {
            path: '/login',
            name: 'login',
            component: () => import('../view/login/Login.vue')
        },
        {
            path: '/about',
            name: 'about',
            // route level code-splitting
            // this generates a separate chunk (About.[hash].js) for this route
            // which is lazy-loaded when the route is visited.
            component: () => import('../components/HelloWorld1.vue')
        },
        {
            path: '/init',
            name: 'init',
            component: () => import('../view/init/Datasource.vue')
        },
    ]
})

export default router
